package com.share.finance.asset.sjd.config;

import com.alibaba.fastjson.JSON;
import com.share.finance.asset.sjd.service.IFieldConfService;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

@Data
@Slf4j
@Component
public class BootInit {
    @Autowired
    private IFieldConfService fieldConfService;

    @PostConstruct
    @Scheduled(cron = "0 0/5 * * * ?")
    public void initFieldConf() {
        log.info("---正在初始化或者刷新-initFieldConf---");
        Object result = fieldConfService.initFieldConf();
        log.info("initFieldConf配置={}", JSON.toJSONString(result));
    }
}
